package com.rocky.component.elasticsearch.config;

import com.rocky.component.elasticsearch.config.property.RockyElasticsearchProperty;
import com.rocky.component.elasticsearch.service.RockyDocumentService;
import com.rocky.component.elasticsearch.service.RockyIndexService;
import lombok.RequiredArgsConstructor;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;

/**
 * @author rocky
 * date 2025-08-11
 * Description:
 */
@RequiredArgsConstructor
public class RockyElasticsearchServiceConfig {

    private final RockyElasticsearchProperty rockyElasticsearchProperty;

    private final RestHighLevelClient restHighLevelClient;

    @Bean
    public RockyIndexService rockyIndexService() {
        return new RockyIndexService(restHighLevelClient);
    }

    @Bean
    public RockyDocumentService rockyDocumentService() {
        return new RockyDocumentService(restHighLevelClient, rockyElasticsearchProperty);
    }
}
